using System.Collections.Generic;

public class GiftMgr
{
	private static string LEVEL_GIFT_PATH = "Cfg/LevelGift";

	private static string GIFT_ITEM = "Cfg/GiftItem";

	private static List<LevelGift> _gifts;

	private static ProbConfig _giftItemCfg;

	public static void Load()
	{
		_gifts = Utils.LoadXML<LevelGift>(LEVEL_GIFT_PATH);
		_giftItemCfg = new ProbConfig(GIFT_ITEM);
	}

	public static LevelGift GetLevel(int type, string name)
	{
		if (_gifts == null)
		{
			return null;
		}
		for (int i = 0; i < _gifts.Count; i++)
		{
			LevelGift levelGift = _gifts[i];
			if (levelGift.levelType == type && levelGift.levelName.Equals(name))
			{
				return levelGift;
			}
		}
		return null;
	}

	public static ProbInfo GetItem()
	{
		if (_giftItemCfg != null)
		{
			return _giftItemCfg.GetItem();
		}
		return null;
	}
}
